package cn.itcast.dtx.seatademo.bank1.client;

import cn.itcast.dtx.seatademo.bank1.client.fallback.Bank2ClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 调用seata-demo-bank2服务接口
 * value：配置在application.yml微服务dtx-seata-demo-bank2的名称
 * spring:
 * application:
 * name: seata-demo-bank2
 * fallback：调用接口回调方法，就是一个降级后的方法。
 */
@FeignClient(value = "seata-demo-bank2", fallback = Bank2ClientFallback.class)
public interface Bank2Client {
    /**
     * 转账
     * /bank2/transfer
     * bank2: 配置在application.yml项目访问名称
     * server:
     *   servlet:
     *     context-path: /bank2
     * transfer：对应controller的方法名称url
     * @param amount
     * @return
     */
    @GetMapping("/bank2/transfer")
    String transfer(@RequestParam("amount") Double amount);
}
